
*******************************************************************************************************
*******************************************************************************************************
*** Title: Can you spot a scam? Measuring and Improving Scam Identification Ability
*** Authors: Jana Cahlikova, Lucy Kaaria, Elif Kubilay, Eva Raiber, and Lisa Spantig

*** Notes: This is the master do.file, which will guide you through the replication process
*******************************************************************************************************
*******************************************************************************************************


***************************************************************************************
**************General 

*Replication package v1. Date: July 5, 2023

*This replication is prepared for STATA. The code was last run on STATA version 17

***Set your STATA version
version 17

***Memory and runtime requirements to reproduce the analysis: 
*under 10 min on a standard 2023 desktop/laptop machine

***Controlled randomness: 
*The code does not include control randomness

***************************************************************************************
**************Set directories

clear 

	if "`c(username)'" == "cahj" { 
	global dropbox "/Users/cahj/Dropbox/IPA consumer protection fraud/Submissions/JDE/Replication Files" 
	}
	
	/* !!!! Others: use the code snippet to set your working directory: need to change your username & path
if "`c(username)'" == "cahj" { 
	global dropbox "/Users/cahj/Dropbox/IPA consumer protection fraud/Submissions/JDE/Replication Files" 
	}	

!!! For the code to work, organize the folders in your working directories as follows
AND save all do files into $dropbox/2_do_files
AND save all data files into $dropbox/1_data
	
*/

*global dropbox "~/Dropbox/IPA consumer protection fraud/SIA Measure/Analysis" 
global datapath "$dropbox/1_data"
global dopath "$dropbox/2_do_files"
global figures "$dropbox/3_figures"
global tables "$dropbox/4_tables"

***************************************************************************************
************Commands to install if not already installed in your Stata
*ssc install cibar
*ssc install cdfplot
*ssc install ereplace
*ssc install iebaltab 

***************************************************************************************
**************Data overview 

*the file "$datapath/online_survey_labeled" is the main data file: it containts the labeled data from the online survey
*the file "$datapath/online_survey_analysis" is obtained from "$datapath/online_survey_labeled" by running 1_SIA_data_preparation.do
*the file "$datapath/online_survey_analysis_respondent_vignette_level" is obtained from "$datapath/online_survey_labeled" by running 1_SIA_data_preparation.do

*The main data file is also available in the csv format "$datapath/online_survey_labeled.csv". The associated codebook is in "$datapath/online_survey_labeled_codebook.xlsx"

***************************************************************************************
**************Do.files overview 

*This file prepares the data for analysis. It uses the data file "$datapath/online_survey_labeled" and saves the analysis data files "$datapath/online_survey_analysis" and "$datapath/online_survey_analysis_respondent_vignette_level"
do "$dopath/1_SIA_data_preparation" 

*This file replicates the figures in the manuscript and the appendix and saves them in the folder "$dropbox/3_figures"
do "$dopath/2_SIA_replication_figures" 

*This file replicates the tables in the manuscript and the appendix and saves them in the folder "$dropbox/4_tables"
do "$dopath/3_SIA_replication_tables" 

***************************************************************************************
**************Viewing the replicated Figures and Tables

*The tex file in the main folder replication_tables_figures.tex uses the figures saved in 3_figures and tables saved in 4_tables and replicates the figures and tables in the manuscript and the Appendix 
